package com.hzy.login;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.widget.Toast;

import com.hzy.listview.NotepadRecordEntity;

import java.util.List;

/**
 * Created by Administrator on 2016/6/23 0023.
 */
public class UserDBHelper extends SQLiteOpenHelper {

    public static final String CREATE_NOTE = "create table Note ("
            + "_id integer primary key autoincrement, "
            + "noteTitle text, "
            + "note text, "
            + "userName text, "
            + "dateTime text)";

    public static final String CREATE_USER = "create table User ("
            + "id integer primary key autoincrement, "
            + "userName text, "
            + "userCode text)";

    private Context context;

    public UserDBHelper(Context context, String name, SQLiteDatabase.CursorFactory factory, int version) {
        super(context, name, factory, version);
        this.context = context;
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
         db.execSQL(CREATE_USER);
         db.execSQL(CREATE_NOTE);
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        db.execSQL("drop table if exists Note");
        db.execSQL("drop table if exists User");
        onCreate(db);
    }

//    List<NotepadRecordEntity>
}
